<?php
	defined('BASEPATH') or exit('No direct script access allowed');
?>
<?php $this->load->view('bm/common/header'); ?>
<body>
<!-- 头部 -->
<?php $this->load->view('bm/common/top'); ?>
<!-- /头部 -->

<!-- 边栏 -->
<?php $this->load->view('bm/common/sidebar'); ?>
<!-- /边栏 -->

<!-- 内容区 -->
<div id="main-content">
	<div id="top-alert" class="fixed alert alert-error" style="display: none;">
		<button class="close fixed" style="margin-top: 4px;">&times;</button>
		<div class="alert-content">这是内容</div>
	</div>
	<div id="main" class="main">

		<!-- nav -->
		<!-- nav -->



		<!-- 标题栏 -->
		<div class="main-title">
			<h2>分类列表</h2>
		</div>
		<div class="cf">
			<div class="fl">
				<a class="btn" href="<?php echo base_url('/bm/category/create');?>">新 增</a>
				<button class="btn ajax-post" url="/index.php?s=/admin/user/changestatus/method/resumeUser.html" target-form="ids">启 用</button>
				<button class="btn ajax-post" url="/index.php?s=/admin/user/changestatus/method/forbidUser.html" target-form="ids">禁 用</button>
				<button class="btn ajax-post confirm" url="/index.php?s=/admin/user/changestatus/method/deleteUser.html" target-form="ids">删 除</button>
			</div>

			<!-- 高级搜索 -->
			<div class="search-form fr cf">
				<div class="sleft">
					<input type="text" name="nickname" class="search-input" value="" placeholder="请输入配置名称">
					<a class="sch-btn" href="javascript:;" id="search" url="/index.php?s=/admin/user/index.html"><i class="btn-search"></i></a>
				</div>
			</div>
		</div>
		<!-- 数据列表 -->
		<div class="data-table table-striped">
			<table class="">
				<thead>
				<tr>
					<th class="">ID</th>
					<th class="">分类名称</th>
					<th class="">积分</th>
					<th class="">登录次数</th>
					<th class="">最后登录时间</th>
					<th class="">最后登录IP</th>
					<th class="">状态</th>
					<th class="">操作</th>
				</tr>
				</thead>
				<tbody>
				<?php echo $category_tree_to_view;?>
				</tbody>
			</table>
		</div>
		<div class="page">
			<div>    </div>    </div>

	</div>
	<?php $this->load->view('bm/common/copyright'); ?>
</div>
<!-- /内容区 -->
<script type="text/javascript">
	(function(){
		var ThinkPHP = window.Think = {
			"ROOT"   : "", //当前网站地址
			"APP"    : "/index.php?s=", //当前项目地址
			"PUBLIC" : "/Public", //项目公共目录地址
			"DEEP"   : "/", //PATHINFO分割符
			"MODEL"  : ["3", "1", "html"],
			"VAR"    : ["m", "c", "a"]
		}
	})();
</script>
<script type="text/javascript" src="/Public/static/think.js"></script>
<script type="text/javascript" src="/Public/Admin/js/common.js"></script>
<script type="text/javascript">
	+function(){
		var $window = $(window), $subnav = $("#subnav"), url;
		$window.resize(function(){
			$("#main").css("min-height", $window.height() - 130);
		}).resize();

		/* 左边菜单高亮 */
		url = window.location.pathname + window.location.search;
		url = url.replace(".html", "")
				.replace(/(\/(p)\/\d+)|(&p=\d+)|(\/(id)\/\d+)|(&id=\d+)/, "");
		$subnav.find("a[href^='" + url + "']").parent().addClass("current");

		/* 左边菜单显示收起 */
		$("#subnav").on("click", "h3", function(){
			var $this = $(this);
			$this.find(".icon").toggleClass("icon-fold");
			$this.next().slideToggle("fast").siblings(".side-sub-menu:visible").
			prev("h3").find("i").addClass("icon-fold").end().end().hide();
		});

		$("#subnav h3 a").click(function(e){e.stopPropagation()});

		/* 头部管理员菜单 */
		$(".user-bar").mouseenter(function(){
			var userMenu = $(this).children(".user-menu ");
			userMenu.removeClass("hidden");
			clearTimeout(userMenu.data("timeout"));
		}).mouseleave(function(){
			var userMenu = $(this).children(".user-menu");
			userMenu.data("timeout") && clearTimeout(userMenu.data("timeout"));
			userMenu.data("timeout", setTimeout(function(){userMenu.addClass("hidden")}, 100));
		});

		/* 表单获取焦点变色 */
		$("form").on("focus", "input", function(){
			$(this).addClass('focus');
		}).on("blur","input",function(){
			$(this).removeClass('focus');
		});
		$("form").on("focus", "textarea", function(){
			$(this).closest('label').addClass('focus');
		}).on("blur","textarea",function(){
			$(this).closest('label').removeClass('focus');
		});

		// 导航栏超出窗口高度后的模拟滚动条
		var sHeight = $(".sidebar").height();
		var subHeight  = $(".subnav").height();
		var diff = subHeight - sHeight; //250
		var sub = $(".subnav");
		if(diff > 0){
			$(window).mousewheel(function(event, delta){
				if(delta>0){
					if(parseInt(sub.css('marginTop'))>-10){
						sub.css('marginTop','0px');
					}else{
						sub.css('marginTop','+='+10);
					}
				}else{
					if(parseInt(sub.css('marginTop'))<'-'+(diff-10)){
						sub.css('marginTop','-'+(diff-10));
					}else{
						sub.css('marginTop','-='+10);
					}
				}
			});
		}
	}();
</script>

<script src="/Public/static/thinkbox/jquery.thinkbox.js"></script>

<script type="text/javascript">
	//搜索功能
	$("#search").click(function(){
		var url = $(this).attr('url');
		var query  = $('.search-form').find('input').serialize();
		query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
		query = query.replace(/^&/g,'');
		if( url.indexOf('?')>0 ){
			url += '&' + query;
		}else{
			url += '?' + query;
		}
		window.location.href = url;
	});
	//回车搜索
	$(".search-input").keyup(function(e){
		if(e.keyCode === 13){
			$("#search").click();
			return false;
		}
	});
	//导航高亮
	$('.side-sub-menu').find('a[href="/index.php?s=/admin/user/index.html"]').closest('li').addClass('current');
</script>

</body>
</html>
